//
//  HelpCenterController.m
//  FinancialProduct
//
//  Created by Stella on 2017/9/14.
//  Copyright © 2017年 maq. All rights reserved.
//

#import "HelpCell.h"
#import "HandleNetProduct.h"
#import "HelpCenterController.h"

@interface HelpCenterController ()
@property (weak, nonatomic) IBOutlet UITableView *myTable;
@property (strong, nonatomic)NSArray *dataArray;

@end

@implementation HelpCenterController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.myTable.estimatedRowHeight=70;
    self.myTable.rowHeight = UITableViewAutomaticDimension;
    [self getDataList];
}
-(void)getDataList{
    NSDictionary *params=@{@"AAAMethodName":@"HelpCenter"};
    [HandleNetProduct getListforParams:params Success:^(NSArray *data) {
        if (data.count>0) {
            _dataArray=data;
            [self.myTable reloadData];
        }
    } Failure:^(NSString *errorInfo) {
        
    }];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    
    return 1;
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    
    
    return self.dataArray.count;
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    HelpCell *cell=[tableView dequeueReusableCellWithIdentifier:@"HelpCell" forIndexPath:indexPath];
    cell.selectionStyle=UITableViewCellSelectionStyleNone;
    cell.accessoryType=UITableViewCellAccessoryNone;
    NSDictionary *dic=_dataArray[indexPath.row];
    cell.question.text=dic[@"Questions"];
    cell.answer.text=dic[@"Answer"];
    [cell layoutIfNeeded];
    return cell;
    
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 0.01f;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.01;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

}

@end
